package com.example.kx004;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.ImageView;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private ImageView[] imgs = new ImageView[12];
    private int[] imagePath = new int[]{
            R.mipmap.img01,
            R.mipmap.img02,
            R.mipmap.img03,
            R.mipmap.img04,
            R.mipmap.img05,
            R.mipmap.img06,
            R.mipmap.img07,
            R.mipmap.img08,
            R.mipmap.img09,
            R.mipmap.img09,
            R.mipmap.img09,
            R.mipmap.img09,
    };


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        GridLayout layout = findViewById(R.id.layout);


        for (int i = 0; i < imagePath.length; i++) {
            imgs[i] = new ImageView(this);
            imgs[i].setImageResource(imagePath[i]);
            imgs[i].setPadding(2,2,2,2);

            ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(200,500);

            imgs[i].setLayoutParams(layoutParams);
            layout.addView(imgs[i]);
        }






    }
}